package server.http;


import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;


public class HttpResponseContent {

    public final static JSONObject LOGIN_INFO = JSONUtil.createObj();

    public final static JSONObject FIELD_INFO = new JSONObject();


    public void init() {
        JSONObject info = JSONUtil.createObj();

        info.putOnce("code", 0)
                .putOnce("msg", "注册成功");
        LOGIN_INFO.putOnce("res_success", info);
        info = new JSONObject();
        info.putOnce("code", 1)
                .putOnce("msg", "登录成功");
        LOGIN_INFO.putOnce("success", info); // 成功的
        info = new JSONObject();
        info.putOnce("code", 2)
                .putOnce("msg", "登录失败");// 登录失败
        LOGIN_INFO.putOnce("fail", info);
        info = new JSONObject();
        info.putOnce("code", 3)
                .putOnce("msg", "密码错误或者账号不存在");
        LOGIN_INFO.putOnce("pwd_err", info); // 密码错误
        info = new JSONObject();
        info.putOnce("code", 4)
                .putOnce("msg", "禁止登录，请检查权限");
        LOGIN_INFO.putOnce("no_access", info);// 没有权限
        info = new JSONObject();
        info.putOnce("code",5)
                .putOnce("msg","登录已过期");
        LOGIN_INFO.putOnce("expire",info);
        info = new JSONObject();
        info.putOnce("code",6)
                .putOnce("msg","退出成功");
        LOGIN_INFO.putOnce("logout",info);
        // 表单验证
        JSONObject info1 = JSONUtil.createObj();
        info1.putOnce("code", 5)
                .putOnce("msg", "请求体为空");
        FIELD_INFO.putOnce("body_empty", info1);

    }

}
